package com.tienon.message.service;

import java.util.concurrent.ExecutionException;

import com.tienon.message.entity.Batch_main;
import com.tienon.message.util.StaticParamsUtil;


public class Batch_mainThread implements Runnable {

	Batch_mainService batch_mainService;
	public Batch_mainThread(Batch_mainService batch_mainService){
		this.batch_mainService = batch_mainService;
	}

	@Override
	public void run() {
		this.init();
	}
	private void init(){
		while(true){
			System.err.println("1=============进入线程："+ Thread.currentThread().getName());
			try {
				Batch_main batch_main = batch_mainService.dealBathch_main();
				if(null == batch_main) 
					continue;
				if(batch_main.getStep() == StaticParamsUtil.STEPZZCLZ){
					try {
						batch_mainService.dealFile(batch_main);
					} catch (ExecutionException e) {
						// TODO Auto-generated catch block
						e.printStackTrace();
					}
				}
				if(batch_main.getStep() == StaticParamsUtil.STEPCRFSBCLZ){
					try {
						batch_mainService.dealRaw_msg_batch(batch_main);
					} catch (ExecutionException e) {
						// TODO Auto-generated catch block
						e.printStackTrace();
					}
				}
			} catch (InterruptedException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
	}
}
